// 注册请求
class UserRegisterRequestEntity {
  String email;
  String password;

  UserRegisterRequestEntity({required this.email, required this.password});

  factory UserRegisterRequestEntity.fromJson(Map<String, dynamic> json) =>
      UserRegisterRequestEntity(
        email: json["email"],
        password: json["password"],
      );

  Map<String, dynamic> toJson() => {"email": email, "password": password};
}

// 登录请求
class UserLoginRequestEntity {
  String email;
  String password;

  UserLoginRequestEntity({required this.email, required this.password});

  factory UserLoginRequestEntity.fromJson(Map<String, dynamic> json) =>
      UserLoginRequestEntity(email: json["email"], password: json["password"]);

  Map<String, dynamic> toJson() => {"email": email, "password": password};
}

// 登录返回
class UserLoginResponseEntity {
  String? token;
  int? user_id;
  List<String>? channels;

  UserLoginResponseEntity({this.token, this.user_id, this.channels});

  factory UserLoginResponseEntity.fromJson(Map<String, dynamic> json) =>
      UserLoginResponseEntity(
        token: json["token"],
        user_id: json["user_id"],
        // channels: List<String>.from(json["channels"].map((x) => x)),
      );

  Map<String, dynamic> toJson() => {
    "token": token,
    "user_id": user_id,
    "channels": channels == null
        ? []
        : List<dynamic>.from(channels!.map((x) => x)),
  };
}
